package com.xiguanlezz.cn.protocol;

import com.xiguanlezz.cn.ProtocolConst;

import java.util.concurrent.atomic.AtomicLong;

/**
 * @Author：习惯了种种
 * @CreateDate：2024/11/4 11:56
 * @Description：请求体创建工厂
 */
public class RpcHeadFactory {
    private static final AtomicLong ID = new AtomicLong();

    public static RpcHeader createRequestHeader(String serializerType) {
        return RpcHeader.builder()
                .magicNumber(ProtocolConst.MAGIC)
                .messageType(RpcMessageType.REQUEST.getType())
                .messageStatus((byte) 1)
                .messageId(ID.incrementAndGet())
                .serializerType(serializerType)
                .build();
    }
}
